package MCQReaderAnsweredAnalyze;

import javax.swing.JOptionPane;

import MCQReaderInterface.MainInterface;

public class DialogBeforeAnalyzis {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	static String dialog = null;
	static String entete_csv = null;
	static private int nbPage = MainInterface.getThisIsIt().getRightFrame()
			.getPdfDisplay().getNbPage();
	static private int nbPageParQCM = MainInterface.getThisIsIt().getLeftFrame()
			.getTree().getRacine().getChildCount();
	static private int nbQCM = nbPage / nbPageParQCM;

	static public boolean canBeginAnalyzis() {
		entete_csv = "\"Nombre de QCM : \"," + nbQCM + ",\"QCM\",\n";
		entete_csv += "\"Nombre de pages par QCM : \"," + nbPageParQCM
				+ ",\"pages\",\n";
		entete_csv += "\"Nombre total de pages : \"," + nbPage
				+ ",\"pages\",\n";
		dialog = "Nombre de QCM : " + nbQCM + "QCM\n";
		dialog += "Nombre de pages par QCM : " + nbPageParQCM + " pages\n";
		dialog += "Nombre total de pages : " + nbQCM + "×" + nbPageParQCM
				+ " = " + nbPage + " pages\n";
		return (JOptionPane.showConfirmDialog(null, dialog
				+ "\n            lancer l'analyse ...",
				"L'analyse va pouvoir commencer!", JOptionPane.YES_NO_OPTION) == JOptionPane.OK_OPTION);
	}

	static public int getNbQCM() {
		return nbQCM;
	}
}
